#ifndef _xNodeType_gate_H_
#define	_xNodeType_gate_H_

#include "xNodeType.h"
#include "xParameterPack.h"


class xNodeType_gate : public xNodeType {
	xParameter _xp ;
	string _valstring ;  
	xMappingNode * _owner_composite ; // gate is always belonged to some composite, this attr store its owner
	string gatename ;
	static string valid_pair[][2];
public:
	xNodeType_gate(string type) { _xp.type = type ; _owner_composite = NULL ; _name = type ; }

	virtual	void		setupPorts() ;
	virtual	string		getType() { return "gate" ; }
	virtual xParameter  toXParameter(string toType, xOutMappingPort * linked_op) ;
	virtual void		createMappedObject();

	virtual string		toMDString(MDSType) ;
	/** parseMDString is called by xMappingTree::fromMDStoxMappingTree() */
	virtual int			 parseMDString(vector<string>& tokens, int start_index);
	virtual bool verify_rhs_link(xOutMappingPort *left, xInMappingPort *right, xNodeType* rightnode);
	virtual bool verify_lhs_link(xOutMappingPort *left, xNodeType* leftnode, xInMappingPort *right);

	virtual bool		update();  // basically when a WOP mapping node is updated, it does nothing
	void set_owner(xMappingNode* owner) { _owner_composite = owner ; }
	virtual void setName(string name);
	virtual void setClass(MNClass classtype);
	virtual void setCategory(MNCategory category);
	virtual int getClass();
	virtual void setDefaultValue(string val);
	virtual string getDefaultValue();
};

#endif 